Imports System.Data.SqlClient
Imports System.Globalization
Public Class frmCrear_Paquetes
    Private mstrValor As String
    Private mintCatalogo As Integer
    Private SEPARADOR As Char
    Private Title As Boolean
    Public ReadOnly Property Valor() As String
        Get
            Valor = mstrValor
        End Get
    End Property
    Public WriteOnly Property Catalogo() As Integer

        Set(ByVal value As Integer)
            mintCatalogo = value
        End Set
    End Property

    Private Elemento1 As New DevComponents.Editors.ComboItem()
    Private Elemento2 As New DevComponents.Editors.ComboItem()
    Private Elemento3 As New DevComponents.Editors.ComboItem()
    Private Sub frmCrear_Paquetes_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Elemento1.FontName = "Segoe UI"
        Elemento1.FontName = "Segoe UI"
        Elemento1.FontSize = 12.0!
        Elemento1.FontStyle = System.Drawing.FontStyle.Italic
        Elemento1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer))
        Elemento1.Text = " "
        Elemento1.TextAlignment = System.Drawing.StringAlignment.Center

        Elemento2.FontName = "Segoe UI"
        Elemento2.FontName = "Segoe UI"
        Elemento2.FontSize = 12.0!
        Elemento2.FontStyle = System.Drawing.FontStyle.Italic
        Elemento2.ForeColor = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer))
        Elemento2.Text = "Buscar mas..."
        Elemento2.TextAlignment = System.Drawing.StringAlignment.Center

        Elemento3.FontName = "Segoe UI"
        Elemento3.FontName = "Segoe UI"
        Elemento3.FontSize = 12.0!
        Elemento3.FontStyle = System.Drawing.FontStyle.Italic
        Elemento3.ForeColor = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer))
        Elemento3.Text = "Registrar nuevo..."
        Elemento3.TextAlignment = System.Drawing.StringAlignment.Center



        lblProducto.BackColor = Color.White
        lblUpc.BackColor = Color.White
        lblEan.BackColor = Color.White
        lblTitulo.BackColor = Color.White
        lblEntarimado.BackColor = Color.White
        lblPaquetes.BackColor = Color.White
        lblUnidadTarima.BackColor = Color.White
        lblUnidadPaquete.BackColor = Color.White
        lblCantidad.BackColor = Color.White
        lblPaquetes.BackColor = Color.White
        lblCapas.BackColor = Color.White
        lblPeso.BackColor = Color.White
        lblOtros.BackColor = Color.White
        lblDescripcion.BackColor = Color.White

        lblProducto.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblEan.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblTitulo.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblEntarimado.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblPaquetes.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblUnidadTarima.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblUnidadPaquete.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblCantidad.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblPaquetes.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblCapas.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblPeso.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblOtros.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lblDescripcion.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)

        txtEan.BackColor = Color.White
        lstProducto.BackColor = Color.White
        txtUpc.BackColor = Color.White
        txtCantidad.BackColor = Color.White
        lstUnidadPaquete.BackColor = Color.White
        txtPaquetes.BackColor = Color.White
        txtCapas.BackColor = Color.White
        txtPeso.BackColor = Color.White
        lstUnidadTarima.BackColor = Color.White

        txtEan.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lstProducto.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        txtUpc.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        txtCantidad.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lstUnidadPaquete.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        txtPaquetes.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        txtCapas.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        txtPeso.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
        lstUnidadTarima.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)

        panelSuperior.Style.BackColor1.Color = Color.White
        panelSuperior.Style.BackColor1.Color = Color.White
        panelSuperior.Style.BorderColor.Color = Color.LightGray

        panelInferior.Style.BackColor1.Color = Color.White
        panelInferior.Style.BackColor2.Color = Color.Silver
        panelInferior.Style.BorderColor.Color = Color.LightGray

        txtEan.Clear()
        lstProducto.Text = ""
        txtUpc.Clear()
        txtCantidad.Clear()
        lstUnidadPaquete.Text = ""
        txtPaquetes.Clear()
        txtCapas.Clear()
        txtPeso.Clear()
        lstUnidadTarima.Text = ""

        SEPARADOR = Application.CurrentCulture.NumberFormat.NumberDecimalSeparator

        Line1.BackColor = Color.White
        Line1.ForeColor = System.Drawing.Color.FromArgb(224, 224, 224)

        Line2.BackColor = Color.White
        Line2.ForeColor = System.Drawing.Color.FromArgb(224, 224, 224)

        Line3.BackColor = Color.White
        Line3.ForeColor = System.Drawing.Color.FromArgb(224, 224, 224)

        If PARAMETROS.ENTRADA_dATOS = 1 Then
            txtDesc.CharacterCasing = CharacterCasing.Upper
        ElseIf PARAMETROS.ENTRADA_dATOS = 2 Then
            txtDesc.CharacterCasing = CharacterCasing.Lower

        ElseIf PARAMETROS.ENTRADA_dATOS = 3 Then
            'FORMAT_CULTURA
        ElseIf PARAMETROS.ENTRADA_dATOS = 0 Then
            txtDesc.CharacterCasing = CharacterCasing.Normal
        End If


        If mintCatalogo = ORIGEN_PRODUCTOS.MATERIALES Then
            CargaProductos_Usados()

        End If
        CargaProductos_Usados()
        CargaUnidades_Usados(ORIGEN_UNIDAD_LOGICA.PAQUETE)
        CargaUnidades_Usados(ORIGEN_UNIDAD_LOGICA.PALLET)

        If ORIGEN_PRODUCTOS.MATERIALES = mintCatalogo Then

        ElseIf ORIGEN_PRODUCTOS.ARTICULOS = mintCatalogo Then
            txtEan.Focus()
        Else
            lstProducto.Focus()
        End If

    End Sub
    Sub CargaProductos(ByVal FILAS As Integer, ByVal IDS As String)
        Dim strSql As String = ""
        Dim strNombre As String = ""


        strSql = "SELECT TOP " & FILAS & " NOMBRE FROM MATERIALES_CAT WHERE IDPRODUCTO NOT IN (" & IDS & ") AND ESTATUS=1 AND TIPO_PROD=1  ORDER BY IDPRODUCTO DESC"

        Dim cnConn As New SqlConnection
        cnConn.ConnectionString = CitraConnection

        Dim cmdBuscar As New SqlCommand
        cmdBuscar.Connection = cnConn
        cmdBuscar.CommandText = strSql
        Dim rdBuscar As SqlDataReader
        cnConn.Open()
        Try
            rdBuscar = cmdBuscar.ExecuteReader
        Catch ex As Exception
            MsgBox(ex.Message)

        End Try


        Do While rdBuscar.Read()
            lstProducto.Items.Add(rdBuscar("RAZON_SOCIAL"))
        Loop


        lstProducto.Items.Add(Elemento1)
        lstProducto.Items.Add(Elemento2)
        If ORIGEN_PRODUCTOS.GENERAL = mintCatalogo Then
            lstProducto.Items.Add(Elemento3)
        End If

    End Sub
    Sub CargaProductos_Usados()
        lstProducto.Items.Clear()

        Dim strSql As String = ""
        Dim strNombre As String = ""


        strSql = "SELECT TOP 7 IPRODUCTO,NOMBRE FROM MATERIALES_CAT WHERE ESTATUS=1 AND TIPO_PROD=1 ORDER BY IDPRODUCTO DESC"

        Dim cnConn As New SqlConnection
        cnConn.ConnectionString = CitraConnection

        Dim cmdBuscar As New SqlCommand
        cmdBuscar.Connection = cnConn
        cmdBuscar.CommandText = strSql
        Dim rdBuscar As SqlDataReader
        cnConn.Open()
        rdBuscar = cmdBuscar.ExecuteReader

        Dim CONT As Integer = 0

        Dim CadenaIds As String = ""
        Dim NOMBRE As String = ""

        Do While rdBuscar.Read()
            lstProducto.Items.Add(rdBuscar("NOMBRE"))
            CONT = CONT + 1
            CadenaIds = CadenaIds & "," & rdBuscar("IPRODUCTO")
            If CONT = 7 Then
                Exit Do
            End If
        Loop

        If CONT = 0 Then
            CadenaIds = ",0"
        End If

        If CONT < 7 Then
            CargaProductos(7 - CONT, Mid(CadenaIds, 2))
        Else
            lstProducto.Items.Add(Elemento1)
            lstProducto.Items.Add(Elemento2)
            lstProducto.Items.Add(Elemento3)
        End If
    End Sub
    Sub CargaUnidades(ByVal FILAS As Integer, ByVal IDS As String, ByVal Origen As Integer)
        Dim strSql As String = ""
        Dim strNombre As String = ""


        strSql = "SELECT TOP " & FILAS & " NOMBRE FROM UNIDADES_LOGISTICA WHERE IDUNIDAD NOT IN (" & IDS & ")  ORDER BY IDUNIDAD DESC"


        Dim cnConn As New SqlConnection
        cnConn.ConnectionString = CitraConnection

        Dim cmdBuscar As New SqlCommand
        cmdBuscar.Connection = cnConn
        cmdBuscar.CommandText = strSql
        Dim rdBuscar As SqlDataReader
        cnConn.Open()
        Try
            rdBuscar = cmdBuscar.ExecuteReader
        Catch ex As Exception
            MsgBox(ex.Message)

        End Try


        Do While rdBuscar.Read()
            If Origen = ORIGEN_UNIDAD_LOGICA.PAQUETE Then
                lstUnidadPaquete.Items.Add(rdBuscar("NOMBRE"))
            Else
                lstUnidadTarima.Items.Add(rdBuscar("NOMBRE"))
            End If

        Loop

        If Origen = ORIGEN_UNIDAD_LOGICA.PAQUETE Then
            lstUnidadPaquete.Items.Add(Elemento1)
            lstUnidadPaquete.Items.Add(Elemento2)
            lstUnidadPaquete.Items.Add(Elemento3)
        Else
            lstUnidadTarima.Items.Add(Elemento1)
            lstUnidadTarima.Items.Add(Elemento2)
            lstUnidadTarima.Items.Add(Elemento3)
        End If
    End Sub
    Enum ORIGEN_UNIDAD_LOGICA
        PAQUETE = 1
        PALLET = 2
    End Enum
    Sub CargaUnidades_Usados(ByVal Origen As Integer)
        lstProducto.Items.Clear()

        Dim strSql As String = ""
        Dim strNombre As String = ""

        If Origen = ORIGEN_UNIDAD_LOGICA.PAQUETE Then
            strSql = "SELECT TOP 7 P.LU,COUNT(P.LU) AS REPETICIONES FROM PAQUETES P INNER JOIN UNIDADES_LOGISTICA U ON P.LU=U.IDUNIDAD GROUP BY P.LU having count(P.LU)>0 ORDER BY COUNT(P.LU)"
        Else
            strSql = "SELECT TOP 7 P.PALLET_LU,COUNT(P.PALLET_LU) AS REPETICIONES FROM PAQUETES P INNER JOIN UNIDADES_LOGISTICA U ON P.PALLET_LU=U.IDUNIDAD GROUP BY P.LU having count(P.PALLET_LU)>0 ORDER BY COUNT(P.PALLET_LU)"
        End If
       
        Dim cnConn As New SqlConnection
        cnConn.ConnectionString = CitraConnection

        Dim cmdBuscar As New SqlCommand
        cmdBuscar.Connection = cnConn
        cmdBuscar.CommandText = strSql
        Dim rdBuscar As SqlDataReader
        cnConn.Open()
        rdBuscar = cmdBuscar.ExecuteReader

        Dim CONT As Integer = 0

        Dim CadenaIds As String = ""
        Dim NOMBRE As String = ""

        Do While rdBuscar.Read()
            If Origen = ORIGEN_UNIDAD_LOGICA.PAQUETE Then
                lstUnidadPaquete.Items.Add(BuscarStrDatoCitra("SELECT NOMBRE FROM UNIDADES_LOGISTICA WHERE IDUNIDAD=" & rdBuscar("LU")))
            Else
                lstUnidadPaquete.Items.Add(BuscarStrDatoCitra("SELECT NOMBRE FROM UNIDADES_LOGISTICA WHERE IDUNIDAD=" & rdBuscar("PALLET_LU")))
            End If

            CONT = CONT + 1
            CadenaIds = CadenaIds & "," & rdBuscar("LU")
            If CONT = 7 Then
                Exit Do
            End If
        Loop

        If CONT = 0 Then
            CadenaIds = ",0"
        End If

        If CONT < 7 Then
            CargaUnidades(7 - CONT, Mid(CadenaIds, 2), Origen)
        Else
            If Origen = ORIGEN_UNIDAD_LOGICA.PAQUETE Then
                lstUnidadPaquete.Items.Add(Elemento1)
                lstUnidadPaquete.Items.Add(Elemento2)
                lstUnidadPaquete.Items.Add(Elemento3)
            Else
                lstUnidadTarima.Items.Add(Elemento1)
                lstUnidadTarima.Items.Add(Elemento2)
                lstUnidadTarima.Items.Add(Elemento3)
            End If
           
        End If
    End Sub

    Private Sub lstProducto_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles lstProducto.KeyDown
        If e.KeyCode = Keys.Enter Then
            txtEan.Focus()

        ElseIf e.KeyCode = Keys.Tab Then
            txtEan.Focus()
        End If
    End Sub

    Private Sub lstProducto_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstProducto.SelectedIndexChanged

    End Sub

    Private Sub txtEan_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtEan.KeyDown
        If e.KeyCode = Keys.Enter Then
            txtUpc.Focus()

        ElseIf e.KeyCode = Keys.Tab Then
            txtUpc.Focus()
        End If
    End Sub

    Private Sub txtEan_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtEan.TextChanged

    End Sub

    Private Sub txtUpc_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtUpc.KeyDown
        If e.KeyCode = Keys.Enter Then
            txtCantidad.Focus()

        ElseIf e.KeyCode = Keys.Tab Then
            txtCantidad.Focus()
        End If
    End Sub

    Private Sub txtUpc_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtUpc.TextChanged

    End Sub

    Private Sub txtCantidad_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtCantidad.KeyDown
        If e.KeyCode = Keys.Enter Then
            lstUnidadPaquete.Focus()

        ElseIf e.KeyCode = Keys.Tab Then
            lstUnidadPaquete.Focus()
        ElseIf e.KeyCode = 13 Then
            Aplica_Config_Numeros(txtCantidad, SEPARADOR)
        End If
    End Sub

    Private Sub txtCantidad_Leave(sender As Object, e As System.EventArgs) Handles txtCantidad.Leave
        Formatea_Numeros(txtCantidad, 2)
    End Sub
   
    Private Sub txtCantidad_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtCantidad.TextChanged
        Valida_Formato_Numeros(txtCantidad, SEPARADOR)
    End Sub

    Private Sub lstUnidadPaquete_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles lstUnidadPaquete.KeyDown
        If e.KeyCode = Keys.Enter Then
            txtPaquetes.Focus()

        ElseIf e.KeyCode = Keys.Tab Then
            txtPaquetes.Focus()
        End If
    End Sub

  
    Private Sub lstUnidadPaquete_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstUnidadPaquete.SelectedIndexChanged
        Dim Elemento As String = lstUnidadPaquete.Text
        If Elemento = "Buscar mas..." Then
            Dim UNIDADES As New frmCat_Unidades_logistica
            UNIDADES.ShowDialog()
            If UNIDADES.DialogResult = Windows.Forms.DialogResult.OK Then
                lstUnidadPaquete.Items.RemoveAt(0)
                lstUnidadPaquete.Items.Insert(0, UNIDADES.Valor)
                lstUnidadPaquete.Text = UNIDADES.Valor
                txtPaquetes.Focus()
            Else
                lstUnidadPaquete.Text = " "
                lstUnidadPaquete.Focus()
            End If
        ElseIf Elemento = "Registrar nuevo..." Then
            If PERMISOS_USUARIO(PERMISOS_UNIDADES_LOGICAS.AGREGAR) = 1 Then
                Dim UNIDADES As New frmCrear_UnidadLogica
                UNIDADES.ShowDialog()
                If UNIDADES.DialogResult = Windows.Forms.DialogResult.OK Then
                    CargaUnidades_Usados(ORIGEN_UNIDAD_LOGICA.PAQUETE)
                    lstUnidadPaquete.Text = UNIDADES.Valor
                    txtPaquetes.Focus()
                Else
                    lstUnidadPaquete.Text = " "
                    lstUnidadPaquete.Focus()
                End If
            Else
                MsgBox("No tienes permiso para registrar nuevas unidades de logistica", MsgBoxStyle.Exclamation, "Aviso")
            End If
        End If
    End Sub

    Private Sub txtPaquetes_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtPaquetes.KeyDown
        If e.KeyCode = Keys.Enter Then
            lstUnidadTarima.Focus()

        ElseIf e.KeyCode = Keys.Tab Then
            lstUnidadTarima.Focus()
        ElseIf e.KeyCode = 13 Then
            Aplica_Config_Numeros(txtPaquetes, SEPARADOR)
        End If
    End Sub

    Private Sub txtPaquetes_Leave(sender As Object, e As System.EventArgs) Handles txtPaquetes.Leave
        Formatea_Numeros(txtPaquetes, 2)
    End Sub

    Private Sub txtPaquetes_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtPaquetes.TextChanged
        Valida_Formato_Numeros(txtPaquetes, SEPARADOR)
    End Sub

    Private Sub lstUnidadTarima_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles lstUnidadTarima.KeyDown
        If e.KeyCode = Keys.Enter Then
            txtCapas.Focus()
        ElseIf e.KeyCode = Keys.Tab Then
            txtCapas.Focus()
        End If
    End Sub

    Private Sub lstUnidadTarima_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstUnidadTarima.SelectedIndexChanged
        Dim Elemento As String = lstUnidadTarima.Text
        If Elemento = "Buscar mas..." Then
            Dim UNIDADES As New frmCat_Unidades_logistica
            UNIDADES.ShowDialog()
            If UNIDADES.DialogResult = Windows.Forms.DialogResult.OK Then
                lstUnidadTarima.Items.RemoveAt(0)
                lstUnidadTarima.Items.Insert(0, UNIDADES.Valor)
                lstUnidadTarima.Text = UNIDADES.Valor
                txtCapas.Focus()
            Else
                lstUnidadTarima.Text = " "
                lstUnidadTarima.Focus()
            End If
        ElseIf Elemento = "Registrar nuevo..." Then
            If PERMISOS_USUARIO(PERMISOS_UNIDADES_LOGICAS.AGREGAR) = 1 Then
                Dim UNIDADES As New frmCrear_UnidadLogica
                UNIDADES.ShowDialog()
                If UNIDADES.DialogResult = Windows.Forms.DialogResult.OK Then
                    CargaUnidades_Usados(ORIGEN_UNIDAD_LOGICA.PAQUETE)
                    lstUnidadTarima.Text = UNIDADES.Valor
                    txtCapas.Focus()
                Else
                    lstUnidadTarima.Text = " "
                    lstUnidadTarima.Focus()
                End If
            Else
                MsgBox("No tienes permiso para registrar nuevas unidades de logistica", MsgBoxStyle.Exclamation, "Aviso")
            End If
        End If
    End Sub

    Private Sub txtCapas_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtCapas.KeyDown
        If e.KeyCode = Keys.Enter Then
            txtPeso.Focus()

        ElseIf e.KeyCode = Keys.Tab Then
            txtPeso.Focus()
        ElseIf e.KeyCode = 13 Then
            Aplica_Config_Numeros(txtCapas, SEPARADOR)
        End If
    End Sub

    Private Sub txtCapas_Leave(sender As Object, e As System.EventArgs) Handles txtCapas.Leave
        Formatea_Numeros(txtCapas, 0)
    End Sub

    Private Sub txtCapas_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtCapas.TextChanged
        Valida_Formato_Numeros(txtCapas, SEPARADOR)
    End Sub

    Private Sub txtPeso_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtPeso.KeyDown
        If e.KeyCode = Keys.Enter Then
            txtDesc.Focus()

        ElseIf e.KeyCode = Keys.Tab Then
            txtDesc.Focus()
        ElseIf e.KeyCode = 13 Then
            Aplica_Config_Numeros(txtPeso, SEPARADOR)
        End If
    End Sub

    Private Sub txtPeso_Leave(sender As Object, e As System.EventArgs) Handles txtPeso.Leave
        Formatea_Numeros(txtPeso, 2)
    End Sub

    Private Sub txtPeso_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtPeso.TextChanged
        Valida_Formato_Numeros(txtPeso, SEPARADOR)
    End Sub

    Private Sub txtDesc_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtDesc.KeyDown
        If e.KeyCode = Keys.Enter Then
            Guardar()

        ElseIf e.KeyCode = Keys.Tab Then
            Guardar()
        End If
    End Sub

    Private Sub txtDesc_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtDesc.TextChanged
        Formato_Titulo(txtDesc)

    End Sub
    Sub Guardar()

    End Sub

    Private Sub btnGuardar_Click(sender As System.Object, e As System.EventArgs) Handles btnGuardar.Click
        Guardar()

    End Sub

    Private Sub btnCancelar_Click(sender As System.Object, e As System.EventArgs) Handles btnCancelar.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
        Close()

    End Sub

    Private Sub btnTodosRegresar_Click(sender As System.Object, e As System.EventArgs) Handles btnTodosRegresar.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
        Close()
    End Sub
End Class